<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>企业微信管理后台</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="js/layui/css/layui.css">
    <link rel="stylesheet" href="css/main.css">
    
</head>

<body>
    <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
    <header class="login_head">
        <div class="login_head_inner">
            <img class="gmmc_logo" src="/images/gmmc-logo.png" alt="广汽三菱.png">
        </div>
    </header>
    <main class="frame_cnt">
        <div class="frame_cnt_inside frame_cnt_inside_Small">
            <div class="login_stage">
                <!-- 扫码登陆 -->
                <div class="login_wechat" id="qrcode" style="display: none;">
                    <h2 class="login_stage_title">
                        <span class="login_stage_title_text">企业微信扫码登录</span>
                    </h2>
                    <div class="ww_wechatQrCode">
                        <div class="login_wechat_qrcode ww_wechatQrCode_cnt">
                            <iframe frameborder="0" scrolling="no" width="300px" height="350px"
                                src="https://work.weixin.qq.com/wework_admin/wwqrlogin/login_qrcode?login_type=login_admin&callback=wwqrloginCallback_1579246925116&redirect_uri=https%3A%2F%2Fwork.weixin.qq.com%2Fwework_admin%2Floginpage_wx%3Fpagekey%3D1579246925116422&crossorigin=1"></iframe>
                        </div>
                        <div class="login_wechat_notice" id="login_wechat_notice" style="display: block;">同时支持微信扫码登录
                        </div>
                    </div>
                </div>
                <!-- 扫码登陆 -->

                <!-- 选择门店 -->
                <div class="login_wechat" id="select_shop">
                    <div class="shop_select_wrapper">
                        <form class="layui-form">
                            <select name="shop" id="shop" lay-filter="shopSelect">
                                <option value="">请选择门店</option>
                                <option value="DD001">DD001</option>
                                <option value="DD002">DD002</option>
                            </select>
                            <button class="qr_login" type="button" lay-submit lay-filter="qr_login">扫码登陆</button>
                        </form>
                    </div>
                </div>
                <!-- 选择门店 -->

                <!-- 帐号密码登陆 -->
                <div class="login_wechat" id="account_psw" style="display: none;">
                    <div class="shop_select_wrapper">
                        <form class="layui-form">
                            <div class="layui-form-item">
                                <label class="layui-form-label">帐号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="account" placeholder="请输入帐号"
                                        autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="password"
                                        placeholder="请输入密码" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item qrcode_form_item">
                                <div class="qrcode" id="qrcode_show">扫码登陆</div>
                            </div>
                            <button class="qr_login" type="button" id="account_login_btn">登陆</button>
                        </form>
                    </div>
                </div>
                <!-- 帐号密码登陆 -->
            </div>
        </div>

        <!-- 2020-02-21 start -->
        <div class="login_registerBar">
            <!-- <span class="login_registerBar_remind">不想扫码登陆？</span> -->
            <a class="login_registerBar_link" href="#">超级管理员登陆</a>
        </div>
        <!-- 2020-02-21 end -->
    </main>
    <script src="js/jquery-3.3.1.min.js" async defer></script>
    <script src="js/layui/layui.js"></script>
    <script>
        layui.use('form', function () {
            var form = layui.form
            form.on('select(shopSelect)', function (data) {
                console.log(data.value)
            })
            form.on('submit(qr_login)', function (data) {
                let shop = data.field.shop
                if (shop == '') {
                    layer.msg('请选择门店后再进行扫码操作')
                    return
                } else {
                    $("#select_shop").hide()
                    $("#qrcode").show()
                    // 请求ajax操作
                }
            })
            $("#account_login_btn").click(function() {
                let account = $("input[name=account]").val()
                let password = $("input[name=password]").val()
                if (account == '') {
                    layer.msg('请输入帐号')
                    return
                } else if (password == '') {
                    layer.msg('请输入密码')
                    return
                } else {
                    window.location.href = '/pages/index.html'
                }
            })

            // 2020-02-21 start
            $(".login_registerBar_link").click(function () {
                $(".login_registerBar").hide()
                $("#select_shop").hide()
                $("#qrcode").hide()
                $("#account_psw").show()
            })
            $("#qrcode_show").click(function() {
                $(".login_registerBar").show()
                $("#select_shop").show()
                $("#qrcode").hide()
                $("#account_psw").hide()
            })
            // 2020-02-21 end
        })
    </script>
</body>

</html>